<template>
  <div class="box">
    <div class="content">
      <img src="../../assets/images/error_images/404.png" alt="404" />
      <h2>哎呀，页面飞走了~</h2>
      <p>你访问的页面不存在或已被删除</p>
      <el-button type="primary" size="large" @click="goHome"
        >返回首页</el-button
      >
    </div>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from "vue-router";
const router = useRouter();

const goHome = () => {
  router.push("/");
};
</script>

<style scoped lang="scss">
.box {
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #0f172a; // 深色背景更显404图

  .content {
    text-align: center;
    animation: fadeIn 1s ease;

    img {
      width: 400px;
      height: auto;
      margin-bottom: 20px;
      animation: float 3s ease-in-out infinite;
    }

    h2 {
      font-size: 28px;
      color: #ffffff;
      margin-bottom: 10px;
    }

    p {
      font-size: 16px;
      color: #94a3b8;
      margin-bottom: 20px;
    }

    .el-button {
      padding: 10px 30px;
    }
  }
}

// 漂浮动画
@keyframes float {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
  100% {
    transform: translateY(0);
  }
}

// 淡入动画
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
</style>
